
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module backend</title>
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>backend</strong></big></big> (version 1.0)</font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/Users/jah/Dropbox/Documents/Coursework/Advanced Software Development/jakme/src/backend.py">/Users/jah/Dropbox/Documents/Coursework/Advanced Software Development/jakme/src/backend.py</a></font></td></tr></table>
    <p><tt>The&nbsp;backend&nbsp;for&nbsp;the&nbsp;jakme&nbsp;editor&nbsp;framework.&nbsp;<br>
&nbsp;<br>
Implements&nbsp;an&nbsp;object&nbsp;capable&nbsp;of&nbsp;suggesting&nbsp;commands&nbsp;to&nbsp;run&nbsp;and&nbsp;piping<br>
input&nbsp;and&nbsp;output&nbsp;between&nbsp;arbitary&nbsp;commands&nbsp;inside&nbsp;a&nbsp;controlled<br>
environment.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
    
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="os.html">os</a><br>
</td><td width="25%" valign=top><a href="subprocess.html">subprocess</a><br>
</td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
    
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="backend.html#Backend">Backend</a>
</font></dt></dl>
 <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Backend">class <strong>Backend</strong></a></font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Implements&nbsp;the&nbsp;backend&nbsp;of&nbsp;the&nbsp;JaKme&nbsp;text&nbsp;editor-a&nbsp;system&nbsp;of<br>
piping&nbsp;text&nbsp;around.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Backend-__init__"><strong>__init__</strong></a>(self, prefix<font color="#909090">='JAKME_'</font>, env<font color="#909090">=None</font>)</dt><dd><tt>Create&nbsp;a&nbsp;new&nbsp;backend&nbsp;object.<br>
&nbsp;<br>
Arguments:<br>
prefix&nbsp;--&nbsp;prefix&nbsp;given&nbsp;to&nbsp;environment&nbsp;variables&nbsp;(by&nbsp;default&nbsp;'JAKME_')<br>
env&nbsp;--&nbsp;any&nbsp;environment&nbsp;variables&nbsp;you&nbsp;wish&nbsp;to&nbsp;initially&nbsp;set</tt></dd></dl>

<dl><dt><a name="Backend-get_environment"><strong>get_environment</strong></a>(self, var, prefix<font color="#909090">=None</font>)</dt><dd><tt>Gets&nbsp;an&nbsp;environment&nbsp;variable&nbsp;from&nbsp;the&nbsp;environment&nbsp;by&nbsp;taking<br>
the&nbsp;variable&nbsp;name&nbsp;and&nbsp;preprending&nbsp;the&nbsp;program&nbsp;prefix&nbsp;(if&nbsp;there&nbsp;is&nbsp;one).<br>
&nbsp;<br>
Argumments:&nbsp;<br>
var&nbsp;--&nbsp;the&nbsp;variable&nbsp;you&nbsp;wish&nbsp;to&nbsp;inspect&nbsp;<br>
prefix&nbsp;--&nbsp;the&nbsp;prefix&nbsp;prepended&nbsp;to&nbsp;the&nbsp;variable&nbsp;internally&nbsp;(default&nbsp;is&nbsp;what<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is&nbsp;defined&nbsp;in&nbsp;the&nbsp;environment</tt></dd></dl>

<dl><dt><a name="Backend-get_global_commands"><strong>get_global_commands</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;paths&nbsp;to&nbsp;commands&nbsp;which&nbsp;should&nbsp;be&nbsp;applied&nbsp;globally&nbsp;to&nbsp;a<br>
file.&nbsp;&nbsp;Returns&nbsp;a&nbsp;dictionary&nbsp;of&nbsp;program&nbsp;names&nbsp;to&nbsp;paths.</tt></dd></dl>

<dl><dt><a name="Backend-get_jakme_commands"><strong>get_jakme_commands</strong></a>(self, subdir)</dt><dd><tt>Fetches&nbsp;commands&nbsp;from&nbsp;the&nbsp;usual&nbsp;places&nbsp;by&nbsp;looking&nbsp;in&nbsp;the&nbsp;subdir<br>
specified.<br>
&nbsp;<br>
Arguments:<br>
subdir&nbsp;--&nbsp;the&nbsp;subdirectory&nbsp;in&nbsp;the&nbsp;config&nbsp;directory&nbsp;where&nbsp;the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;commands&nbsp;reside&nbsp;and&nbsp;the&nbsp;same&nbsp;one&nbsp;in&nbsp;the&nbsp;filetype&nbsp;directory.</tt></dd></dl>

<dl><dt><a name="Backend-get_regional_commands"><strong>get_regional_commands</strong></a>(self)</dt><dd><tt>Gets&nbsp;the&nbsp;paths&nbsp;to&nbsp;commands&nbsp;which&nbsp;should&nbsp;be&nbsp;applied&nbsp;regionally&nbsp;to<br>
text.&nbsp;&nbsp;Returns&nbsp;a&nbsp;dictionary&nbsp;of&nbsp;program&nbsp;names&nbsp;to&nbsp;paths.</tt></dd></dl>

<dl><dt><a name="Backend-send_text"><strong>send_text</strong></a>(self, command, input_text<font color="#909090">=''</font>)</dt><dd><tt>Send&nbsp;a&nbsp;body&nbsp;of&nbsp;text&nbsp;through&nbsp;a&nbsp;command.&nbsp;Return&nbsp;the&nbsp;output&nbsp;and<br>
error&nbsp;messages&nbsp;of&nbsp;that&nbsp;command.<br>
&nbsp;<br>
Arguments:<br>
command&nbsp;--&nbsp;path&nbsp;to&nbsp;executable<br>
input_text&nbsp;--&nbsp;text&nbsp;to&nbsp;be&nbsp;piped&nbsp;into&nbsp;the&nbsp;command&nbsp;(default&nbsp;is&nbsp;empty)</tt></dd></dl>

<dl><dt><a name="Backend-set_environment"><strong>set_environment</strong></a>(self, dictionary, prefix<font color="#909090">=None</font>)</dt><dd><tt>Sets&nbsp;a&nbsp;variable&nbsp;in&nbsp;the&nbsp;environment<br>
&nbsp;<br>
Arguments:<br>
dictionary&nbsp;--&nbsp;a&nbsp;mapping&nbsp;of&nbsp;variable&nbsp;names&nbsp;to&nbsp;value<br>
prefix&nbsp;--&nbsp;the&nbsp;prefix&nbsp;to&nbsp;append&nbsp;to&nbsp;all&nbsp;variables</tt></dd></dl>

</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
    
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt><a name="-get_commands"><strong>get_commands</strong></a>(path)</dt><dd><tt>Find&nbsp;all&nbsp;the&nbsp;executable&nbsp;commands&nbsp;in&nbsp;a&nbsp;directory.<br>
&nbsp;<br>
Scans&nbsp;all&nbsp;the&nbsp;files&nbsp;in&nbsp;a&nbsp;path&nbsp;and&nbsp;adds&nbsp;them&nbsp;to&nbsp;a&nbsp;dictionary&nbsp;where<br>
the&nbsp;name&nbsp;of&nbsp;the&nbsp;program&nbsp;is&nbsp;tied&nbsp;to&nbsp;the&nbsp;path&nbsp;of&nbsp;it.Returns&nbsp;this<br>
dictionary&nbsp;when&nbsp;all&nbsp;files&nbsp;are&nbsp;scanned.&nbsp;Only&nbsp;top&nbsp;level&nbsp;files&nbsp;in&nbsp;the<br>
path&nbsp;are&nbsp;scanned.&nbsp;It&nbsp;will&nbsp;not&nbsp;currently&nbsp;recurse&nbsp;any&nbsp;deeper.</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
    
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>__author__</strong> = 'Joseph Hallett &amp; Kiri Baildon-Smith'<br>
<strong>__version__</strong> = '1.0'</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#7799ee">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr>
    
<tr><td bgcolor="#7799ee"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%">Joseph&nbsp;Hallett&nbsp;&amp;&nbsp;Kiri&nbsp;Baildon-Smith</td></tr></table>
</body></html>